<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      function rev(n) {
        var str = n;
        str1 = str.charAt(0).toUpperCase(); //I
        str2 = str.charAt(1); //空格
        str3=str.charAt(2).toUpperCase(); //L
        str4=str.slice(3, 7); //ove+空格
        str5=str.charAt(7).toUpperCase(); //J
        str6=str.slice(8, 18); //avascript+空格
        str7=str.charAt(18).toUpperCase(); //v
        str8=str.slice(19, 23); //ery +空格
        str9=str.charAt(23).toUpperCase(); //M
        str10=str.slice(24, 27); //uch+空格
        str11=str1+str2+str3+str4+str5+str6+str7+str8+str9+str10;
        console.log(str11);
      }
      rev("i love javascript very much");
    </script>
  </head>
  <body></body>
</html>
